package com.homework;

import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Scanner;

public class TankGame extends JFrame {
    private MyPanel mp = null;

    public static void main(String[] args) {
        new TankGame();
    }

    public TankGame() {
        int key=0;
        Scanner scanner = new Scanner(System.in);
        System.out.println("选择:\n1.继续上局游戏\n2.重新开始");
        mp = new MyPanel(scanner.nextInt());
        this.add(mp);
        this.setSize(1300, 800);
        this.setVisible(true);
        this.addKeyListener(mp);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                Recorder.keepRecord();
                System.exit(0);
            }
        });
    }
}
